//
// itertool - a polynormial and type-safe iterator framework in C++.
//
// Copyright (c) 2021-2025 Feng Cong
//
// Distributed under the MIT Software License
// See accompanying file LICENSE.txt or copy at
// https://opensource.org/licenses/MIT

#pragma once

#include <itertool/itertool_fwd.h>

namespace itertool_test {

using FiboItem = double;

class FiboNumberIterable : public itertool::InfiniteIterableBase<FiboItem> {
 public:
  using ItemType = FiboItem;
  FiboNumberIterable() = default;
  ItemType GetNow() override { return first_; }
  void Advance() override {
    ItemType temp = second_;
    second_ += first_;
    first_ = temp;
  }

 private:
  ItemType first_ = 0, second_ = 1;
};

inline itertool::Iterator<FiboItem> FiboNumber() {
  return itertool::MakeIterator<FiboNumberIterable>();
}

}  // namespace itertool_test
